<template>
    <div class="address-page">
        <!-- Header -->
        <Header title="我的收货地址">
            <template v-slot:back>
                <span @click="$router.go(-1)">&lt;</span>
            </template>
            <template v-slot:ope>
                
            </template>
        </Header>

        <!-- 地址列表 -->
        <div class="address-list">
            <div class="address" v-for="(item,index) in addressList" :key="index">
                <div class="text">
                    <div class="name">{{item.address}}</div>
                    <div>{{item.name}} {{item.phone}}</div>
                </div>
                <router-link :to="{name:'edit',params: {item} }" class="ope">
                    编辑
                </router-link>
            </div>
        </div>

        <div class="btn-box">
            <router-link to="/add" class="btn">新增地址</router-link>
        </div>
    </div>
</template>

<script>

import {mapState} from 'vuex'

export default {
    data(){
        return {
            
        }
    },
    computed:{
        ...mapState(['addressList'])
    }
}
</script>
<style scoped >
.address-list .address{
    display: flex;
    margin: 0 20px;
    padding: 20px 0;
    border-bottom: 1px solid #f0f0f0;
}
.address-list .address .text{
    flex: 1;
}
.address-list .address .ope{
    width: 60px;
    text-align: right;
    margin-left: 20px;
}

.btn-box{
    margin: 20px;
}
.btn-box .btn{
    line-height: 50px;
    text-align: center;
    background-color: orange;
    color: white;
    display: block;
    text-decoration: none;
}
</style>